#include <stdafx.h>

#include "Project.h"

enum eFields { eProject, eShip, eFile };
CString sFields[] = {"PROJECT", "SHIP", "FILES"};

CProject::CProject()
{
}

CProject::CProject(CString fileName)
{
	m_ProjectFile = fileName;
}

CProject::~CProject()
{
}

void CProject::NewFile(const CString &shipName, const CString &fileName)
{
	//m_ShipFiles[shipName].
}

CString CProject::getProjectFileName()
{
	return m_ProjectFile;
}

CString CProject::getProjectName()
{
	return m_ProjectName;
}

void CProject::setProjectFileName(const CString &fileName)
{
	m_ProjectFile.Format(_T("%s"), fileName);
}

void CProject::setProjectName(const CString &fileName)
{
	m_ProjectName.Format(_T("%s"), fileName);
}

bool CProject::NewProject()
{
	bool rtn = true;
	CStdioFile file;
	CString outString;

	if(file.Open(m_ProjectFile, CFile::modeCreate|CFile::modeWrite))
	{
		outString.Format(_T("%s: %s\n"),sFields[eProject],m_ProjectName);
		file.WriteString(outString);
		file.WriteString(_T("\n"));
		file.Close();
	}

	return rtn;
}

bool CProject::OpenProject()
{
	bool rtn = true;

	return rtn;
}

list<CString> CProject::getFileNames(const CString &shipName)
{
	list<CString> rtn;
	for(list<CLanguage>::iterator itr = m_Languages.begin();
		itr != m_Languages.end(); itr++)
	{
		for(list<CString>::iterator itr2 = (*itr).getFileNames().begin();
			itr2 != (*itr).getFileNames().end(); itr2++)
		{
			rtn.push_back((*itr2));
		}
	}
	return rtn;
}